NULL sentinel attribute
authorØyvind Kolås <ok@src.gnome.org>
Sun, 11 Sep 2005 19:27:19 +0000 (19:27 +0000)
committerØyvind Kolås <ok@src.gnome.org>
Sun, 11 Sep 2005 19:27:19 +0000 (19:27 +0000)
ChangeLog
babl/babl-format.c
babl/babl-model.c
babl/babl.h

index 25ae69e194a3c5d7fd7d73813356429266dc9665..10e585348fe82890a71da8ba820d05687094f61a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-09-11  Øyvind Kolås  <pippin@gimp.org>
+
+       * babl/babl.h: use gcc 4.x attribute for NULL sentinel.
+       * babl/babl-format.c: (babl_format_new): added missing enumeration
+       values to switch.
+       * babl/babl-model.c: (babl_model_new): added missing enumeration
+       values to switch.
+
 2005-09-11  Øyvind Kolås  <pippin@gimp.org>
 
        * tests/formats.c: new test (that might form the basis of loss
index 45ffcf0723607cb2f30ca8ac803c0a8609c75c25..f461639b6256576d96403e620cdf0cea1f5dbf84 100644 (file)
@@ -199,6 +199,8 @@ babl_format_new (void *first_arg,
           switch (babl->class_type)
             {
               case BABL_TYPE:
+              case BABL_TYPE_FLOAT:
+              case BABL_TYPE_INTEGER:
                 current_type = (BablType*) babl;
                 break;
               case BABL_COMPONENT:
@@ -236,8 +238,10 @@ babl_format_new (void *first_arg,
               case BABL_CONVERSION_PLANE:
               case BABL_CONVERSION_PLANAR:
               case BABL_FISH:
+              case BABL_FISH_SIMPLE:
               case BABL_FISH_REFERENCE:
               case BABL_IMAGE:
+              case BABL_EXTENSION:
                 babl_log ("%s unexpected",
                            babl_class_name (babl->class_type));
                 break;
index d3fa47844cf5846884d5c10ffb15b3cea5fc435f..f48779e0995f8450f12f78d9b3f2de54319a6cbd 100644 (file)
@@ -113,6 +113,8 @@ babl_model_new (void *first_argument,
                   babl_log ("submodels not handled yet");
                   break;
               case BABL_TYPE:
+              case BABL_TYPE_INTEGER:
+              case BABL_TYPE_FLOAT:
               case BABL_SAMPLING:
               case BABL_INSTANCE:
               case BABL_FORMAT:
@@ -124,7 +126,9 @@ babl_model_new (void *first_argument,
               case BABL_CONVERSION_PLANAR:
               case BABL_FISH:
               case BABL_FISH_REFERENCE:
+              case BABL_FISH_SIMPLE:
               case BABL_IMAGE:
+              case BABL_EXTENSION:
                 babl_log ("%s unexpected", babl_class_name (babl->class_type));
                 break;
               case BABL_SKY: /* shut up compiler */
index b178456c36a2a0fbc047f32d2d55c24e92284f92..6b6085fb683ebae58c10a2eeadf0e6bca3366431 100644 (file)
@@ -41,6 +41,11 @@ void   babl_init       (void);
  */
 void   babl_destroy    (void);
 
+#if     __GNUC__ >= 4
+#define BABL_ARG_NULL_TERMINATED __attribute__((__sentinel__))
+#else
+#define BABL_ARG_NULL_TERMINATED
+#endif
 
 #define BABL_CLASS_NO_NAME(type_name)                            \
                                                                  \
@@ -55,7 +60,7 @@ void   babl_##type_name##_each    (BablEachFunction  each_fun,   \
 BABL_CLASS_NO_NAME (type_name)                                   \
 Babl * babl_##type_name           (const char       *name);      \
 Babl * babl_##type_name##_new     (void             *first_arg,  \
-                                   ...);
+                                   ...) BABL_ARG_NULL_TERMINATED;
 
 typedef int  (*BablEachFunction) (Babl *entry,
                                   void *data);
@@ -99,7 +104,7 @@ long   babl_process    (Babl *babl_fish,
  *                    NULL);
  */
 Babl * babl_image      (void *first_component,
-                        ...);
+                        ...) BABL_ARG_NULL_TERMINATED;